package cn.sumpu.app.guoguojie.biz;

import java.util.Map;

import cn.sumpu.app.guoguojie.constant.TransactionType;
import cn.sumpu.app.guoguojie.domain.Account;
import cn.sumpu.app.guoguojie.domain.AccountLog;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.PageModel;

public interface AccountBiz {
    /**
     * 根据账户ID获取账户详细信息.
     * 
     * @param accountId
     *            账户ID
     * @return 账户的详细信息
     * @throws AppBusinessException
     *             获取失败
     */
    public Account getAccountByAccountId(String accountId) throws AppBusinessException;

    /**
     * 生成账户交易日志.
     * 
     * @param log
     *            交易日志对象
     * @throws AppBusinessException
     *             生成日志失败
     */
    public void log(AccountLog log) throws AppBusinessException;

    /**
     * 人民币转帐.
     * 
     * @param fromAccountId
     *            转出账户ID
     * @param toAccountId
     *            转入账户ID
     * @param rmb
     *            人民币数量
     * @param operator 操作者
     * @param transactionType 交易类型
     * @param summary
     *            交易摘要
     * @throws AppBusinessException
     *             转帐失败
     */
    public void transferRmbByAccountId(String fromAccountId, String toAccountId, double rmb, String summary, String operator, TransactionType transactionType)
                                                                                                                                                   throws AppBusinessException;

    /**
     * 人民币转帐.
     * 
     * @param fromMemberId
     *            转出会员ID
     * @param toMemberId
     *            转入会员ID
     * @param rmb
     *            人民币数量
     * @param operator 操作者
     * @param transactionType 交易类型
     * @param summary
     *            交易摘要
     * @throws AppBusinessException
     *             转帐失败
     */
    public void transferRmbByMemberId(String fromMemberId, String toMemberId, double rmb, String summary, String operator, TransactionType transactionType)
                                                                                                                                                         throws AppBusinessException;

    /**
     * 按条件分页检索账户交易记录.
     * 
     * @param params 检索参数
     * @return 交易记录
     * @throws AppBusinessException 检索失败
     */
    public PageModel getAccountLog(Map<String, Object> params) throws AppBusinessException;

    /**
     * 根据指定的会员ID获取账户详细.
     * 
     * @param memberId
     *            会员ID
     * @return 账户的详细信息
     * @throws AppBusinessException
     *             获取失败
     */
    public Account getAccountByMemberId(String memberId) throws AppBusinessException;

    /**
     * 根据会员ID创建新账户.
     * 
     * @param memberId
     *            会员ID
     * @throws AppBusinessException
     *             创建失败
     */
    public void createAccountByMemberId(String memberId) throws AppBusinessException;

    /**
     * 向指定的账户存入人民币.
     * 
     * @param accountId
     *            帐号ID
     * @param rmb
     *            人民币数量
     * @param summary
     *            交易摘要
     * @param operator 操作者
     * @param transactionType 交易类型
     * @throws AppBusinessException
     *             存人民币失败
     */
    public void depositRmbByAccountId(String accountId, double rmb, String summary, String operator, TransactionType transactionType) throws AppBusinessException;

    /**
     * 从指定的账户取人民币.
     * 
     * @param accountId
     *            帐号ID
     * @param rmb
     *            人民币数量
     * @param summary
     *            交易摘要
     * @param operator 操作者
     * @param transactionType 交易类型
     * @throws AppBusinessException
     *             取人民币失败
     */
    public void withdrawRmbByAccountId(String accountId, double rmb, String summary, String operator, TransactionType transactionType) throws AppBusinessException;

    /**
     * 向指定的账户存入人民币.
     * 
     * @param memberId
     *            会员ID
     * @param rmb
     *            人民币数量
     * @param summary
     *            交易摘要
     * @param operator 操作者
     * @param transactionType 交易类型
     * @throws AppBusinessException
     *             存人民币失败
     */
    public void depositRmbByMemberId(String memberId, double rmb, String summary, String operator, TransactionType transactionType) throws AppBusinessException;

    /**
     * 从指定的账户取人民币.
     * 
     * @param memberId 家ID
     * @param rmb 人民币数量
     * @param summary 交易摘要
     * @param operator 操作者
     * @param transactionType 交易类型
     * @throws AppBusinessException
     *             取人民币失败
     */
    public void withdrawRmbByMemberId(String memberId, double rmb, String summary, String operator, TransactionType transactionType) throws AppBusinessException;

    /**
     * 验证账户.
     * 
     * @param accountId 账户Id
     * @return true-账户正常，false-账户不正常
     * @throws AppBusinessException 验证失败
     */
    public Boolean verifyAccountByAccountId(String accountId) throws AppBusinessException;
    
    /**
     * 验证账户.
     * 
     * @param memberId 会员Id
     * @return true-账户正常，false-账户不正常
     * @throws AppBusinessException 验证失败
     */
    public Boolean verifyAccountByMemberId(String memberId) throws AppBusinessException;

    /**
     * 验证账户.
     * 
     * @param account 账户
     * @return true-账户正常，false-账户不正常
     * @throws AppBusinessException 验证失败
     */
    public Boolean verifyAccount(Account account) throws AppBusinessException;

    /**
     * 检查账户人民币余额.
     * 
     * @param account 账户对象
     * @param rmbAmount 支出人民币数量
     * @return true 可以支出，false-不可以支出
     * @throws AppBusinessException 验证失败
     */
    public Boolean checkAccountForRmb(Account account, double rmbAmount) throws AppBusinessException;

}
